package br.com.season.collections;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class CustomerTesteDesafio {

	public static void main(String[] args) {
	
		List customerRef = new ArrayList();
		Set set = new HashSet();
		
		for (int i=0; i<200; i++) {
			Customer custumer = new Customer(i, "Name"+i);
			if(set.add(custumer)){
				customerRef.add(custumer);
			}
		}
		
		
		
//		for (int i=0; i<200; i++) {
//			Customer custumer = new Customer(i, "Name"+i);
//			if (customerRef.indexOf(custumer) < 0){
//				customerRef.add (custumer);
//			}
//		}
		
		for (int i=0; i<200; i++) {
			Customer custumer = new Customer(i, "Name"+i);
			if (!customerRef.contains(custumer)){
				customerRef.add (custumer);
			}
		}
		
		
		for(Object obj : customerRef){
			Customer customer = ( Customer ) obj;
			System.out.println(customer);
		}
		
	}

}
